#include <bits/stdc++.h>
using namespace std;

template<typename T>
void benchmark(const string &name, const T &func) {
  auto start = chrono::high_resolution_clock::now();
  func();
  auto end = chrono::high_resolution_clock::now();
  auto duration = chrono::duration_cast<chrono::milliseconds>(end - start);
  cout << name << " execution time: " << duration.count() << "ms\n";
}

mt19937 rnd(0);
int main() {
  int n = 300000000;
  vector<int> arr(n);
  for (auto &x : arr) x = rnd();
  benchmark("unfold", [&]() {
    int sum0 = 0, sum1 = 0, sum2 = 0, sum3 = 0;
    for (int i = 0; i < n; i += 4) {
      sum0 += arr[i];
      sum1 += arr[i+1];
      sum2 += arr[i+2];
      sum3 += arr[i+3];
    }
    cout << sum0 + sum1 + sum2 + sum3 << endl;
  });

  
  benchmark("normal", [&]() {
    int sum = 0;
    for (int i = 0; i < n; i ++) {
      sum += arr[i];
    }
    cout << sum << endl;
  });
}